package com.example.javalib;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

public class LinkedHashMapTest {
    public static void main(String[] args) {
        LinkedHashMap<String,Integer> hashMap=new LinkedHashMap<>();
        hashMap.put("one",1);
        hashMap.put("one",11);
        hashMap.put("two",2);
        hashMap.put("four",4);
        hashMap.put("four",44);

//        Iterator<Map.Entry<String, Integer>> linkedHashMapIterator = hashMap.entrySet().iterator();
        Iterator<Map.Entry<String, Integer>> it = hashMap.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry<String, Integer> entry = it.next();
            System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());
        }
    }
}
